package com.tao.pojo.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Product implements Serializable {
    private static final long serialVersionUID = 1L;
    //对于 Redis 来说，所有存储的数据都是字节序列，所以在存储复杂的对象（Product 对象）时，必须先将它们序列化
    //否则无法存储

    private Integer id;

    private String name;

    private BigDecimal price;

    private Integer stock;

    private String image;

    private String description;

    private Integer status; // 建议使用枚举类型以增加代码可读性

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    private Integer createUser;

    private Integer updateUser;

    private Integer categoryId;
}
